package com.game.server.system;

import com.game.majiang.config.DataManager;
import com.game.majiang.logic.LogicWatchWar;
import com.game.server.message.IRespose;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class AbstractTable extends AbstractPlayerBase {

	protected int type;
	protected long gameStartTime = 0;//游戏开始时间 
	protected boolean gameEnd = false;//桌子结束
	protected long tableCreateTime = System.currentTimeMillis();
	protected LogicWatchWar watchWar;//观战

	public long tableOnly = DataManager.getInstance().getTabelOnly();

	public int gettype()
	{
		return type;
	}

	public void settype(int type)
	{
		this.type = type;
	}

	public AbstractTable(int id)
	{
		super(id);
	}
	/**
	 * 
	 * @param rsp
	 * @param type 0游戏玩家  1观战  2全部
	 */
	public void BroadCast(IRespose rsp, int type)
	{
		if(rsp != null)
		{
			if(type == 0) {
				for(AbstractPlayer c :getPlayers()) {
					c.client.Send(rsp);
				}
			} else if(type == 1) {
				this.watchWar.BroadCast(rsp, 0);
			} else if(type == 2) {
				for(AbstractPlayer c :getPlayers()) {
					c.client.Send(rsp);
				}
				this.watchWar.BroadCast(rsp, 0);
			}
			
		}
	}
	
}
